"""线索详情页面"""
from selenium.common import NoSuchElementException
from selenium.webdriver.common.by import By

from page.base_page import BasePage

class ViewCluePage(BasePage):
    url="/index.php?m=leads&a=view&id=28"
    #定位器
    back_locator = (By.LINK_TEXT, "返回")
    ul_locator = (By.CSS_SELECTOR, "#right_list > ul")
    log_locator = (By.CSS_SELECTOR, "#right_list > ul > li:nth-child(2) > a")
    task_locator = (By.XPATH, "/html/body/div[5]/div/div[3]/ul/li[3]/a")
    add_log_locator = (By.CSS_SELECTOR, "#ui-id-7")
    def click_back(self):
        #点击线索详情的返回
        self.find_element(self.back_locator).click()
    def add_log(self):
       self.find_element(self.log_locator).click()
    def log_text(self):
        try:
            text=self.find_element(self.log_locator).text
        except NoSuchElementException:
            text=""
        return text
    def add_task(self):
        self.find_element(self.task_locator).click()
    def task_text(self):
        try:
            text=self.find_element(self.task_locator).text
        except NoSuchElementException:
            text=""
        return text